﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ActiveReportsDemo.Viewers
{
    public partial class TocViewer : DemoBaseUserControl
    {
        public TocViewer()
        {
            InitializeComponent();
            ReportViewer.LoadCompleted += new GrapeCity.ActiveReports.Document.LoadCompletedEventHandler(ReportViewer_LoadCompleted);
        }

        void ReportViewer_LoadCompleted(object sender, EventArgs e)
        {
            ReportViewer.Sidebar.SelectedIndex = 1;
            ReportViewer.Sidebar.ToggleVisibility();   
        }

        /// <summary>
        /// 显示报表
        /// </summary>
        /// <param name="name"></param>
        public override void ShowReport()
        {
            switch (CurrentReportName)
            {
                case "rptMonthlySalesByCategory.rdlx":
                    GrapeCity.ActiveReports.PageReport pagereport = CommonFunction.CreatePageReport(CurrentReportName, ReportViewer, null);
                    ReportViewer.Sidebar.SelectedIndex = 1;
                    ReportViewer.Sidebar.TocPanel.Visible = true;
                    base.reportDesigner.Report = pagereport;
                    base.ReportWebBrowser.DocumentText = CommonFunction.getDescription(CurrentReportID);
                    break;
                default:
                    break;
            }
         
        }
    }
}
